<?php

abstract class Validator extends QValidator
{
    static function validate_is_addressTab($value)
    {
        $provinceVal = isset($value['province'])? $value['province'] : null;
        $cityVal = isset($value['city'])? $value['city'] : null;
        $areaVal = isset($value['area'])? $value['area'] : null;
        
        if($provinceVal && $cityVal && $areaVal){
	        $addressTab = Util::getAddrTab();
	        if(isset($addressTab[$provinceVal][$cityVal])){
	        	return in_array($areaVal, $addressTab[$provinceVal][$cityVal]);
	        }
	        return false;
        }
        
        return false;
    }
    
    static function validate_not_null($value)
    {
    	if($value === null || $value === ''){
    		return false;
    	}
    	return true;
    }
    
    static function validate_in_array($value, $array)
    {
    	return in_array($value, $array);
    }
}
